package com.violet.controller.app;

import com.violet.domain.emuns.OrderStatus;
import com.violet.domain.result.ResultPage;
import com.violet.domain.search.MyPage;
import com.violet.domain.vo.app.AOrderVo;
import com.violet.utils.OrderUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/app/order/completed")
@RequiredArgsConstructor
public class ACompletedOrderController {

    private final OrderUtils orderUtils;

    // 分页获取已完成订单
    @GetMapping
    public ResultPage<List<AOrderVo>> getCompletedOrders(@ModelAttribute MyPage myPage) {
        return orderUtils.getOrder(myPage, OrderStatus.COMPLETED);
    }

}
